//
//  RZIMUIConfig.m
//  RZIM
//
//  Created by reyzhang on 2021/8/3.
//

#import "RZIMUIConfig.h"

@implementation RZIMUIConfig

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.globalConversationAvatarStyle = USER_AVATAR_RECTANGLE;
        self.globalConversationPortraitSize = CGSizeMake(46, 46);
        self.globalMessageAvatarStyle = USER_AVATAR_RECTANGLE;
        self.globalMessagePortraitSize = CGSizeMake(40, 40);
        self.portraitImageViewCornerRadius = 5;
        self.globalConversationDateFormate = @"yyyy.MM.dd";
        self.globalMessageDateFormat = @"yyyy.MM.dd";
        self.globalConversationPortraitLeftMargin = 15;
        self.globalConversationPortraitRightMargin = 10;
        self.badgePosition = BADGE_POSITION_ON_LEFT;
        self.imageMessageCompressRatio = 0.6;
    }
    return self;
}

- (void)setGlobalConversationPortraitSize:(CGSize)globalConversationPortraitSize {
    CGFloat width = globalConversationPortraitSize.width;
    CGFloat height = globalConversationPortraitSize.height;

    if (height < 36.0f) {
        height = 36.0f;
    }

    _globalConversationPortraitSize.width = width;
    _globalConversationPortraitSize.height = height;
}

- (void)setGlobalMessagePortraitSize:(CGSize)globalMessagePortraitSize {
    CGFloat width = globalMessagePortraitSize.width;
    CGFloat height = globalMessagePortraitSize.height;

    _globalMessagePortraitSize.width = width;
    _globalMessagePortraitSize.height = height;
}


- (void)setImageMessageCompressRatio:(CGFloat)imageMessageCompressRatio {
    CGFloat ratio = imageMessageCompressRatio;
    if (ratio < 0.5) {
        ratio = 0.5;
    }
    if (ratio > 1) {
        ratio = 1;
    }
    
    _imageMessageCompressRatio = ratio;
}


@end
